import time
import datetime


class Assignment:
    def __init__(self, data):
        self.id: int = data[0]
        self.gid: int = data[1]
        self.name: str = data[2]
        self.endTimestamp: int = data[3]
        self.type_tag: int = data[4]

    @classmethod
    def attendence(cls, gid):
        data = []
        data.append(None)
        data.append(gid)
        data.append(str(datetime.date.today()))
        millis = int(round((time.time() + 600) * 1000))
        data.append(millis)
        data.append(2)
        return cls(data)

    def __str__(self):
        return 'id: {}, gid:{}, name:{}, endTimestamp:{}, type:{}' \
            .format(self.id, self.gid, self.name, self.endTimestamp, self.type_tag)
